﻿using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Collections.Generic;
using Tools;
namespace UnitTestProject
{
    public class entity
    {
        public int id { get; set; }
        public string name { get; set; }
    }
    [TestClass]
    public class ToolsUnitTest1
    {

        [TestMethod]
        public void testHttpClient()
        {
            string v = "";// HttpClient.Get2("", "http://news.163.com/", null);
            v = HttpClient.Get("http://news.163.com/", "");
        }

        [TestMethod]
        public void testSerializable()
        {
            entity en = new entity() { id = 123, name = "abc" };
            string v = Serializable.Serialize(en);

            en.id = 1;

            en = (entity)Serializable.Deserialize(typeof(entity), v);
        }

        [TestMethod]
        public void testLogHelper()
        {
            LogHelper.Info("ABC");
        }

        [TestMethod]
        public void testJsonHelper()
        {
            entity en = new entity();
            en.id = 1;
            en.name = "wzb";
            string v = JsonHelper.Serializer(en);

            entity b = JsonHelper.Deserialize<entity>(v);
            v = b.name;


            List<entity> list = new System.Collections.Generic.List<entity>();
            list.Add(en);

            v = JsonHelper.Serializer(list);

            list = null;

            list = JsonHelper.Deserialize<List<entity>>(v);

        }

        [TestMethod]
        public void testEncryption()
        {
            string password = "wzb123";
            string encry = Encryption.Encrypt(password);

            password = "";

            password = Encryption.Decrypt(encry);
        }
    }


}
